/*
 * @lc app=leetcode id=191 lang=cpp
 *
 * [191] Number of 1 Bits
 */
class Solution {
public:
    int hammingWeight(uint32_t n) {
        
        int num = 0;
        while(n) {
            n = (n-1)&n;
            num++;
        }
        return num;
        
    }
};

